import React, {Component} from 'react';
import {View, StyleSheet, TouchableOpacity,Image,Text} from 'react-native';
import Potato from '@greens/potato/src/potato'
import NavigationBar from '../navigation/navigation-bar.view';
import ImageBoxCollection from "../image-box-collection/index";

export default class ImageBoxUploadDemo extends Potato {
    constructor(props) {
        super(props);
        this.state = {
            mediaSources: [{
                url:"http://photocdn.sohu.com/20120708/Img347586981.jpg"
            },{
                url:"http://pic44.nipic.com/20140727/18179070_152408117000_2.jpg"
            },{
                url:"http://photocdn.sohu.com/20120708/Img347586981.jpg"
            },{
                url:"http://pic44.nipic.com/20140727/18179070_152408117000_2.mp4",
                preview:"http://photocdn.sohu.com/20120708/Img347586981.jpg"
            },{
                url:"http://aaaaa.pdf",
            },{
                url:"add" ///显示加号
            }
            ]
        };
    }

    render() {
        return (
            <View style={styles.container}>
                <NavigationBar title='image box collection'/>
                <ImageBoxCollection
                    dataSource={this.state.mediaSources}
                    lineMaxCount={3}
                    isReadOnly={false}
                    onItemPick={(index,callback)=>{
                        alert(index)
                    }}
                />
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F6F6F6',
    },
});
